﻿using System;
using System.Windows.Input;
using System.Windows.Media;
using SampleApplication.Resources;
using YourLastOptionsDialog.Core.Attributes;

namespace SampleApplication.OptionsModels
{
    public class SampleOptions
    {
        #region Booleans (in two pivot items)

        // This will be added to the default group, which is "general" if not configured otherwise
        public bool IsPickedUpWithoutAttribute
        {
            get;
            set;
        }

        [OptionBoolean(DisplayName = "Is Sample?",
            Description = "This is a sample property.",
            GroupName = "booleans",
            UserMustConfirmActivation = true,
            ActivationPrompt = "Do you really want to turn on this sample property?")]
        public bool IsSample
        {
            get;
            set;
        }

        [OptionBoolean(ResourceType = typeof(AppResources),
            DisplayName = "SampleResourceEntry",
            Description = "SampleResourceEntryDescription",
            GroupName = "booleans",
            UserMustConfirmDeactivation = true,
            DeactivationPrompt = "SampleResourceEntryDeactivationPrompt")]
        public bool IsUsingResources
        {
            get;
            set;
        }

        public bool IsIgnoreBecauseItHasNoPublicSetter
        {
            get;
            private set;
        }

        [OptionIgnore]
        public bool IsIgnoredBecauseItIsAttributed
        {
            get;
            set;
        }

        #endregion

        #region Enums

        [OptionEnum(DisplayOrder = 1, GroupName = "enums")]
        public DemoEnum MyEnumValue
        {
            get;
            set;
        }

        [OptionEnum(DisplayName = "A value from a long enum", Description = "This will trigger the ListPicker's full mode.", DisplayOrder = 0, GroupName = "enums")]
        public LongDemoEnum MyLongEnumValue
        {
            get;
            set;
        }

        #endregion

        #region DateTime

        [OptionDateTime(DisplayName = "Date only",
            Description = "Shows only a date picker",
            DisplayOrder = 0,
            GroupName = "datetime",
            Mode = DateTimeMode.Date)]
        public DateTime DateOnly
        {
            get;
            set;
        }

        [OptionDateTime(DisplayName = "Time only",
            Description = "Shows only a time picker",
            DisplayOrder = 1,
            GroupName = "datetime",
            Mode = DateTimeMode.Time)]
        public DateTime TimeOnly
        {
            get;
            set;
        }

        [OptionDateTime(DisplayName = "The whole thing",
            DisplayOrder = 2,
            GroupName = "datetime",
            Mode = DateTimeMode.DateTime)]
        public DateTime Both
        {
            get;
            set;
        }

        #endregion

        #region TimeSpan

        [OptionTimeSpan(GroupName = "timespans")]
        public TimeSpan SampleDuration
        {
            get;
            set;
        }

        [OptionTimeSpan(DisplayName = "Limited Timespan",
            Description = "Max: 2 minutes, Step: 2 seconds",
            GroupName = "timespans",
            Maximum = "0:2:0",
            Step = "0:0:2")]
        public TimeSpan LimitedTimeSpan
        {
            get;
            set;
        }

        #endregion

        #region Integrals

        [OptionIntegral(GroupName = "integrals")]
        public int AnInteger
        {
            get;
            set;
        }

        [OptionIntegral(DisplayName = "A Short",
            Description = "Demonstrates that other integral types work too.",
            GroupName = "integrals")]
        public short AShort
        {
            get;
            set;
        }

        [OptionIntegral(DisplayName = "Limited",
            Description = "Min: 12, Max: 42",
            GroupName = "integrals",
            Minimum = 12,
            Maximum = 42,
            ValidationErrorMessage = "Please enter a number between 12 and 42.")]
        public int Limited
        {
            get;
            set;
        }

        #endregion

        #region Floats

        [OptionFloat(Description = "Limited to 0.0 - 1.0",
            GroupName = "floats",
            Minimum = 0.0,
            Maximum = 1.0,
            ValidationErrorMessage = "Please enter a number between 0.0 and 1.0.")]
        public float FloatValue
        {
            get;
            set;
        }

        [OptionFloat(GroupName = "floats")]
        public decimal SomeDecimal
        {
            get;
            set;
        }

        #endregion

        #region Strings

        [OptionString(Description = "This string is limited to a minimum of 2 and a maximum of 10 characters.",
            GroupName = "strings",
            MinLength = 2,
            MaxLength = 10,
            ValidationErrorMessage = "Please enter a string of length 2-10.")]
        public string StringWithLengthLimit
        {
            get;
            set;
        }

        [OptionString(Description = "This string makes use of an InputScop for telefone numbers.",
            GroupName = "strings",
            InputScopeNameValue = InputScopeNameValue.TelephoneNumber)]
        public string TelephoneNumber
        {
            get;
            set;
        }

        [OptionString(Description = "This string uses a simple regular expression for validation.",
            GroupName = "strings",
            RegularExpression = @"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$",
            InputScopeNameValue = InputScopeNameValue.EmailNameOrAddress,
            ValidationErrorMessage = "Please enter a valid email address.")]
        public string EMailAddress
        {
            get;
            set;
        }

        [OptionString(
            Description =
                "This uses a custom implementation of IValidator to check for all lower case letters. All the other properties like Min/MaxLength, RegularExpression etc. are ignored once a validator is set."
            ,
            GroupName = "strings",
            ValidatorType = typeof(CustomValidator))]
        public string NeedsToBeLowerCase
        {
            get;
            set;
        }

        #endregion

        #region Passwords

        [OptionPassword(Description = "This is a single password, e.g. authentication credentials.",
            GroupName = "passwords",
            MinLength = 3,
            ValidationErrorMessage = "A password must be at least 3 characters long.")]
        public string MyPassword
        {
            get;
            set;
        }

        [OptionPassword(Description = "This is a password with confirmation, e.g. to change an existing password.",
            GroupName = "passwords",
            ShowConfirmation = true,
            ConfirmationDescription = "Confirm the password:",
            PasswordsDoNotMatchErrorMessage = "Password and password confirmation do not match.",
            MinLength = 3,
            ValidationErrorMessage = "A password must be at least 3 characters long.")]
        public string MyOtherPassword
        {
            get;
            set;
        }

        #endregion

        #region Colors

        [OptionColor(DisplayName = "A sample color",
            Description = "Pick a color using the slider below.",
            GroupName = "colors")]
        public Color SampleColor
        {
            get;
            set;
        }

        #endregion
    }
}